﻿using System;

namespace Util.QueryParser.Token
{
    class BooleanAnd : IToken
    {
        private readonly IToken left;
        private readonly IToken right;

        public BooleanAnd(IToken left, IToken right)
        {
            if (left == null || right == null)
            {
                throw new ArgumentException("Parameters must not be null");
            }
            this.left = left;
            this.right = right;
        }

        public bool Evaluate(string value)
        {
            return left.Evaluate(value) && right.Evaluate(value);
        }
    }
}
